//
//  KeChengDaGangTableViewCell.m
//  ZhiBoYuan
//
//  Created by apple on 2018/4/17.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "KeChengDaGangTableViewCell.h"
#import "CourseItem.h"

@interface KeChengDaGangTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *typeImage;

@property (weak, nonatomic) IBOutlet UILabel *courseTitle;

@property (weak, nonatomic) IBOutlet UILabel *dateLabel;

@property (weak, nonatomic) IBOutlet UIButton *stateLabel;

@property (weak, nonatomic) IBOutlet UIButton *liveStateLabel;


@end
@implementation KeChengDaGangTableViewCell





- (void)setItem:(CourseItem *)item{
    _item = item;
    
    NSLog(@"%@",item.sub_type);
    NSString *videoType;
    if ([item.sub_type isEqualToString:@"weike"]) {
        [self.typeImage1 setImage:[UIImage imageNamed:@"CourseDetailDianBoIcon"]];
        videoType = @"[录播]";
        self.dateLabel.text = @"";
    }else if ([item.sub_type isEqualToString:@"huifang"]){
        [self.typeImage1 setImage:[UIImage imageNamed:@"CourseDetailHuiFangIcon"]];
        videoType = @"[回放]";
        self.dateLabel.text = item.start_time;

    }else if ([item.sub_type isEqualToString:@"zhibo"] || [item.sub_type isEqualToString:@"yugao"]){
      [self.typeImage1 setImage:[UIImage imageNamed:@"CourseDetailZhiboIcon"]];
        videoType = @"[直播]";
        self.dateLabel.text = item.start_time;

    }
    
    self.courseTitle.text = [NSString stringWithFormat:@"%@%@",videoType,item.name];
    
    if ([item.is_free isEqualToString:@"1"]) {
        self.stateLabel.hidden = NO;
    }else{
        self.stateLabel.hidden = YES;
    }
    
    
}

- (void)awakeFromNib {
    [super awakeFromNib];

    //    self.contentView.backgroundColor = [UIColor clearColor];
}

-(UIImageView *)typeImage1{
    if (!_typeImage1) {
        _typeImage1 = [[UIImageView alloc]initWithFrame:CGRectMake(20, 20, 30, 30)];
        _typeImage1.contentMode = UIViewContentModeScaleAspectFit;
        [self.contentView addSubview:self.typeImage1];
    }
    return _typeImage1;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
